It's all about the answers!

Ask a question

Where is the REST/OSLC API for CRUD of RTC Releases?


Rophy Tsai (231217) | asked Sep 24 '15, 8:44 a.m.
As title, I wasn't able to find the REST / OSLC API for updating Releases.


Accepted answer


permanent link
Fernando Silva (8124) | answered Sep 24 '15, 10:57 a.m.
Try do execute a POST request to <ccm_url_with_port>/service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/releases informing the Content Type as application/x-www-form-urlencoded and Accept as text/json. The Form Entity must be as follows:

projectAreaItemId: <projectArea_UUID>
releases:[{"sequenceValue":3,"isArchived":false,"isFiltered":<true_or_false>,"name":"<release_name>","description":"<description>","creationDate":<milliseconds_representing_the_desired_date>,"isModified":true}]

Example in Java using Eclipse Lyo's infrastructure:

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import com.sun.jersey.api.representation.Form;

JSONObject releaseObj = new JSONObject();
releaseObj.put("sequenceValue", 3);
releaseObj.put("isArchived", false);
releaseObj.put("isFiltered", false);
releaseObj.put("name", releaseValue);
releaseObj.put("description", "Description");
releaseObj.put("creationDate", new Date().getTime());
releaseObj.put("isModified", true);
JSONArray array = new JSONArray();
array.add(releaseObj);

Form form = new Form();
form.add("projectAreaItemId", projectAreaUuid);
form.add("releases", array.toString());

JazzRootServicesHelper helper = new JazzRootServicesHelper(rtcUrl, OSLCConstants.OSLC_CM_V2);
JazzFormAuthClient client = helper.initFormClient( userName,password);

client.formLogin();

ClientResponse response = client
.createResource(rtcUrl+ "/service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/releases",
form, "application/x-www-form-urlencoded", "text/json");

Rophy Tsai selected this answer as the correct answer

Comments
Fernando Silva commented Sep 24 '15, 11:09 a.m.

 To update an existing release, first you need to retrieve the list of releases using a GET request to /service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/releases?includeArchived=<true_or_false>&projectAreaItemId=<project_area_uuid> using Accept as text/json. Use the response to find the desired release and finally, execute the same POST above but now informing the new data, the itemId and the _eQualifiedClassName:

[{"creationDate":1436583600000,"description":"Desc2","name":"1.2.6","_eQualifiedClassName":"com.ibm.team.workitem.rest.dto:ReleaseDTO","isArchived":false,"isFiltered":false,"itemId":"_2g134Sg9EeWyhrGcjiBgww","sequenceValue":3,"isModified":true}]

Regards, Fernando.

2 other answers



permanent link
Rophy Tsai (231217) | answered Sep 24 '15, 1:09 p.m.
 worked perfectly, thanks!

permanent link
jane zhou (1061068) | answered Mar 24 '16, 6:36 a.m.
 HI Rophy,

       I have tried on RTC 6.02M2 for this solution, but it is failed. Could you give me some suggestion on how to fix it? Thanks!
 
     First, I use the following link to GET current release:
<server:port>/ccm /service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/releases?includeArchived=<true_or_false>&projectAreaItemId=<project_area_uuid> using Accept astext/json. 

      It can return content properly.

    {"_eQualifiedClassName":"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/:Envelope","soapenv:Body":{"response":{"returnValue":{"values":[{"creationDate":1458057600000,"description":"","name":"test_build_001","_eQualifiedClassName":"com.ibm.team.workitem.rest.dto:ReleaseDTO","isArchived":false,"isFiltered":false,"itemId":"_mwyCAOuZEeWQNIfNlw2urw","sequenceValue":1}],"_eQualifiedClassName":"http:\/\/\/com\/ibm\/team\/core\/services.ecore:ComplexArrayDataArg","type":"COMPLEX"},"method":"getReleases","_eQualifiedClassName":"http:\/\/\/com\/ibm\/team\/core\/services.ecore:Response","interface":"com.ibm.team.workitem.common.internal.rest.IWorkItemRestService"},"_eQualifiedClassName":"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/:Body"}}

 Then I use it to generate my content with json type:
 { "projectAreaItemId": "_4tIsgOIaEeWAtoLsweCfow","releases":[{"creationDate":1436583600000,           "description":"Desc2","name":"1.2.6","_eQualifiedClassName":"com.ibm.team.workitem.rest.dto:ReleaseDTO",         "isArchived":false,"isFiltered":false,"itemId":"_mwyCAOuZEeWQNIfNlw2urw","sequenceValue":1,"isModified":true}]}

And use POST method to send it to the same URI for GET
<server:port>/ccm /service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/releases?includeArchived=<true_or_false>&projectAreaItemId=<project_area_uuid>

Then system report system internal error. I checked the log, which indicated POST request  triggered something wrong inside RTC.  And I have tried to remove my content with "{ }", the error is the same. So, it should not be my content which trigger the issue.

I am wondering any update for this interface? Maybe it is not supported anymore? or there is BUG here?

CRJAZ1163E NullPointerException error occurred while processing a POST request for com.ibm.team.workitem.common.internal.rest.IWorkItemRestService.postReleases(). CRJAZ1170I The request was made by user "ming_zhou" from "10.100.24.141".CRJAZ1166I The stack trace hash is A70752CD706E8465712DDD0A7B667274381C7DB2.
Throwable
java.lang.NullPointerException
at java.io.StringReader.(StringReader.java:62)
at com.ibm.team.workitem.service.internal.rest.WorkItemRestService.postReleases(WorkItemRestService.java:3129)
at sun.reflect.GeneratedMethodAccessor50279.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)


  

Comments
Vladimir Amelin commented Nov 01 '16, 5:02 a.m.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.